class Utils {
    static generateId() {
        return Math.random().toString(36).substring(2, 9);
    }

    static formatUrl(url) {
        if (!url) return '';
        // 简单的URL格式化
        return url.replace(/^rtsp:\/\//, '').replace(/\/$/, '');
    }

    static calculateFps(frameTimes, duration = 1000) {
        const now = performance.now();
        // 移除duration毫秒前的帧记录
        while (frameTimes.length > 0 && (now - frameTimes[0]) > duration) {
            frameTimes.shift();
        }
        return frameTimes.length;
    }
}